#include "saveher.h"
#include "ui_saveher.h"
#include "menu.h"
#include <QPainter>
#include <QFont>
#include <QPixmap>
#include <QTimer>

int i6=1;

saveher::saveher(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::saveher)
{
    ui->setupUi(this);
    this->setAttribute(Qt::WA_DeleteOnClose);
}

void saveher::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    painter.setPen(Qt::black);//设置画笔颜色
    painter.setBrush(Qt::black);//设置填充颜色
    painter.drawRect(0,0,480,480);
    QFont font1("Courier New",10);
    painter.setFont(font1);
    painter.setPen(Qt::white);
    painter.setBrush(Qt::white);
    //第三次
    if (i6==4&&playthrough>=4)
    {
        i6=10;
    }
    if (i6>=10)
    {
        QFont font1("Courier New",8);
        painter.setPen(Qt::red);
        painter.setBrush(Qt::red);
        painter.drawText(10,370,dialog[i6]);
    }
    if (i6==23)
    {
        resolution++;
        i6=4;
        this->close();
        encounter *e =new encounter();
        e->show();
    }
    //第一次
    if (i6<=2)
    {
        painter.drawText(20,370,dialog[i6]);
    }
    if (i6==3)
    {
        resolution++;
        i6++;
        this->close();
        encounter *e =new encounter();
        e->show();
    }
    //第二次
    if (i6>=4&&i6<=8)
    {
        if (i6==8)
        {
            painter.setPen(Qt::red);
            painter.setBrush(Qt::red);
        }
        painter.drawText(20,370,dialog[i6]);
    }
    if (i6==9)
    {
        resolution++;
        i6=4;
        this->close();
        encounter *e =new encounter();
        e->show();
    }

}

void saveher::on_nextpushButton_clicked()
{
    i6++;
    update();
}


saveher::~saveher()
{
    delete ui;
}
